/*
 * AnswerFieldsFile.java
 *
 * Copyright (C) 2011 Thomas Everingham
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 3 of the License.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * A copy of the GNU General Public License can be found in the file
 * LICENSE.txt provided with the source distribution of this program (see
 * the META-INF directory in the source jar). This license can also be
 * found on the GNU website at http://www.gnu.org/licenses/gpl.html.
 *
 * If you did not receive a copy of the GNU General Public License along
 * with this program, contact the lead developer, or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 *
 * If you find this program useful, please tell me about it! I would be delighted
 * to hear from you at tom.ingatan@gmail.com.
 */

package org.ingatan.data;

import java.util.Enumeration;
import java.util.Hashtable;

/**
 * This class encapsulates the data from the answer fields file. It contains a list
 * of the classes and class IDs for all default answer fields and all answer fields that
 * have been added as plug-ins. It also contains the default values for the answer fields,
 * as set by the user.
 * @author Thomas Everingham
 * @version 1.0
 */
public class AnswerFieldsFile {
    Hashtable answerFieldDefaults;
    Hashtable answerFields;

    /**
     * Creates a new <code>AnswerFieldsFile</code>.
     * @param answerFields Hashtable containing the loaded classes for the answer fields, mapped by their class name
     * @param fieldDefaults The defaults for the answers fields. These are generated and read by AnswerField implementations. Defaults are generated by the user.
     */
    public AnswerFieldsFile(Hashtable<String,Class> answerFields, Hashtable<String,String> fieldDefaults) {
        this.answerFieldDefaults = fieldDefaults;
        this.answerFields = answerFields;

        //Note: the default AnswerFields are inserted in the ParserWriter method, while the file is being parsed.
    }

    /**
     * Gets the hash table containing answer field defaults.
     * @return the hash table containing answer field defaults.
     */
    public Hashtable getAnswerFieldDefaults() {
        return answerFieldDefaults;
    }

    /**
     * Gets the hashtable containing classes by their class names.
     * @return the hashtable containing answer field classes by their class names.
     */
    public Hashtable getAnswerFields() {
        return answerFields;
    }

    /**
     * Gets an enumeration of the answer field classIDs
     * @return an enumeration of the answer field classIDs
     */
    public Enumeration getAnswerFieldClassIDs() {
        return answerFields.keys();
    }




}
